Chat Agent bugfix to treat workspace file references and attachments separately - #2717
Merged
Conversation
hillary-mutisya
approved these changes
Jul 24, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 475784cc-a88f-4fae-ab22-4b5b562b7ff3
…icrosoft/TypeAgent into dev/georgeng/fix_chat_file_bug
The pull's text-merge of pnpm-lock.yaml dropped the root esbuild@0.28.1 dependency that main added in #2785, so pnpm install --frozen-lockfile (the CI default) failed with ERR_PNPM_OUTDATED_LOCKFILE. Regenerated the lockfile with pnpm 11.9.0 so it matches the merged package.json manifests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 475784cc-a88f-4fae-ab22-4b5b562b7ff3
GeorgeNgMsft
marked this pull request as ready for review
August 4, 2026 00:08
GeorgeNgMsft
enabled auto-merge
August 4, 2026 00:10
GeorgeNgMsft
disabled auto-merge
August 4, 2026 03:06
GeorgeNgMsft
enabled auto-merge
August 4, 2026 04:51
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Aug 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix chat agent crash on highlighted editor files
Problem
When a user highlights lines in an editor (no upload) and asks a question, the
dispatcher's
[Editor context]carries the workspace-relative file path, and theLLM puts it into
chat.generateResponse.relatedFiles. The chat agent assumedevery related file was an uploaded attachment staged under the session's
user_files/, joined the name there, andsessionStorage.readthrew ENOENT —failing the entire response. It also tried to embed every related file as an
image and only handled Windows path separators.
Fix
rehydrateImageAttachmentsintypechat-utils(used byboth
chatanddispatcher/search, replacing two near-identical copies). Itgates on image MIME before any storage read, so a highlighted
.ymlisskipped with zero I/O — no read, no crash. Missing image uploads are caught and
skipped. Also fixes a latent doubled-
image/data-URL bug and makes theuser_fileslookup portable viapath.join(the old\..\user_files\onlyresolved on Windows).
relatedFileToEntity): uploaded images →["file","image","data"]; other references →["file"](was hardcoded toimage for everything).
relatedFilescomment so the model only listsuploaded attachment names, not editor/workspace files.